<?php
	session_start();
	include ("../includes/conn.php");

	import_request_variables("gp","v_");
	$csn=$v_csn;
	$keywords=$v_keywords;
	$gnname=$keywords;
	
	if (!isset($_SESSION['id'])){
		$_SESSION['id'] = md5(rand());
	}
	
	//add product to shopping cart
	if (isset($addsign) && $addsign == '1'){
		require_once("../includes/cart.php");
	}
	
	//update shopping cart when amount and/or promo code change
	if (isset($button) && $button == 'Update'){
		if ($qtychg <> ''){
			require_once("../includes/cart-upd.php");
		}
	}
	
	// delete selected product in shopping cart
	if (isset($button2) && $button2 == 'Remove'){
		require_once ('../includes/cart-delete.php');
	}
	
	//empty all products in shopping cart
	if (isset($button5) && $button5 == 'Clear All' ){
		require_once ('../includes/cart-empty.php');
	}
	
	//check out shopping cart for payment
	if (isset($button3) && $button3 == 'Check Out' ){
		echo "<script language=javascript>location.href='../includes/cart-checkout.php?';</script>";
		exit;
	}
	
	if (isset($gnname)){
		$find = "select * from subcat where sname = '$gnname'";
		$find_res = mysql_query($find,$db);
		$find_r = mysql_fetch_array($find_res);
		$ssn = $find_r['sn'];
	}
	
	if (!isset($cart)){
		$cart = 0;
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php include ("../includes/title.php");?>
<link href="../style/abmnew.css" rel="stylesheet" type="text/css" />
<link href="../style/mirna.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#submenu {
	background:url(../premadeLenti/images/banner-stemcellvirus2.jpg) right top;
	background-repeat:no-repeat;
}
#prod-name {
	font-family:Arial, Helvetica, sans-serif;
	font-weight:bold;
	font-size:16px;
	color:#000;
	margin-top:-1px;
}
</style>
</head>
<body>
<?php include ("../includes/header.php");?>
<div id="content">
  <?php include ("../includes/logosearch.php");?>
  <div id='container'>
    <div id='leftmenu'>
      <?php
	  	if (!isset($alpha)){
			$alpha = "A";
		}
	  	if (!isset($csn)){
			$csn = 10;
		}
	  	include ("../includes/leftMenu.php");
	  ?>
    </div>
    <div id='rightcontent'>
      <div id='submenu'>
        <div id='subtitle'><?php echo"$catname";?></div>
      </div>
      <?php include ("../includes/premadeSiRNAsrch.php");?>
<div id='prod-detail'>
        <div id='order'>To order, check the corresponding box(es) on the right, and then click 'Add to Cart'.
          <form id="form2" name="form2" method="post" action="">
            <div id = 'exp-list'>
              <table id='exp-table' width='100%' border='0' cellspacing='0' cellpadding='0'>
                <tr>
                  <th align='left' width='33%'>Product</th>
                  <th align='left' width='18%'>Acc. No.</th>
                  <th align='left' width='12%'>Size</th>
                  <th align='left' width='14%'>Cat. No.</th>
                  <th align='right' width='12%'>Price</th>
                  <th align='center' width='8%'><img src='../img/icons/shopping_cart.png' width='17' height='17' /></th>
                </tr>
                <?php
					//search for all Pre-Made Lentiviruses under the gene name.
					include ("../includes/keywords.php");
					$prod = "select * from prodlenti where ((LOWER(CONCAT($claus,'lentivirus')) like '%$keywords%') or (LOWER(CONCAT($claus,'lentiviral')) like '%$keywords%')) and catNo not like 'LV010154' and catNo not like 'LV010158' order by catNo";
					$prod_res = mysql_query($prod,$db);
					$prod_rows = mysql_num_rows ($prod_res);
						if ($prod_rows > 0){
							while($prod_r = mysql_fetch_array($prod_res)){
								$ssn=$prod_r['ssn'];
								$dsn=$prod_r['dsn'];
								$pname=$prod_r['pname'];
								$catno=$prod_r['catNo'];
								$accession=$prod_r['AccessionNumber'];
								$price=$prod_r['price'];
								$quantity=$prod_r['quantity'];
								if ($catno == 'LV010147'){
									continue;
								}
								echo"<tr>
										<td align='left'><a href='/premadeLenti/premadeLenti-dispOne.php?csn=10&ssn=$ssn&dsn=$dsn&catanumber=$catno&alpha=$alpha'>$pname</a></td>
										<td align='left'>$accession</td>
										<td align='left'>$quantity</td>
										<td align='left'>$catno</td>
										<td align='right' class='price'>$$price</td>
										<td align='center'><input type='checkbox' name='grp[]' value='$catno' /></td>
									 </tr>";
							}								
						}
				?>
              </table>
            </div>
            <div id = 'exp-add'>
              <input name='car' type='hidden' id='car' value='1'/>
              <input type="hidden" name="addsign" id="addsign" value='1' />
              <input name='csn' type='hidden' id='csn' value='<?php echo $csn;?>'/>
              <input name='ssn' type='hidden' id='ssn' value='<?php echo $ssn;?>'/>
              <input name='dsn' type='hidden' id='dsn' value='<?php echo $dsn;?>'/>
              <input id="expcart" name="expcart" type="submit" value="Add to Cart" />
            </div>
          </form>
        </div>
        <div id='cart'><a href='?cart=<?php echo ($cart+1)%2;?>&amp;<?php echo "csn=10&amp;alpha=$alpha&amp;keywords=$keywords#cart"; ?>'><img id="carttab" src="../images/cart.png" border="0" /></a></div>
        <?php include('../includes/shoppingCart.php');?> 
      </div>
    </div>
  </div>
</div>
<?php 
include("../includes/footer.php");
?>

<!-- Piwik --> 
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://www.abmgood.com/piwik/" : "http://www.abmgood.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script>
<noscript>
<p><img src="http://www.abmgood.com/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p>
</noscript>
<!-- End Piwik Tag -->
</body>
</html>
